<?php 

class Countries extends CI_Controller {

 function __construct() {
   parent::__construct();
   $this->load->model('countries_model');
   $this->load->database();
 }

 function returncountries() {
   //query the database
   $result = $this->countries_model->getcountries();
   if($result) {
     echo json_encode($result);
   }
 }
}
?>